package com.fy.module.user.mapper;

import com.fy.module.user.entity.UserRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户和角色关联表 Mapper 接口
 * </p>
 *
 * @author yang
 * @since 2023-03-22
 */
public interface UserRoleMapper extends BaseMapper<UserRole> {

    @Select("select sr.role_key from sys_user_role \n" +
            "Left join sys_role sr ON sr.role_id = sys_user_role.role_id \n" +
            "where sys_user_role.user_id = #{userId}")
    List<String> findRolesByUserId(String s);

}
